package com.dianshang.dao;

import com.dianshang.pojo.goods.Brand;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandDao extends Mapper<Brand> {

    @Select("SELECT\n" +
            "\t* \n" +
            "FROM\n" +
            "\ttb_brand \n" +
            "WHERE\n" +
            "\tid IN (\n" +
            "SELECT\n" +
            "\tbrand_id \n" +
            "FROM\n" +
            "\ttb_category_brand \n" +
            "WHERE\n" +
            "\tcategory_id IN (\n" +
            "SELECT\n" +
            "\tid \n" +
            "FROM\n" +
            "\ttb_category \n" +
            "WHERE\n" +
            "\t`name` = #{categoryName} ) )\n" +
            "\t\n" +
            "ORDER BY\n" +
            "\tseq")
    List<Brand> findBrand(String categoryName);

}